<template>

    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
        <van-swipe-item v-for="(item,index) in bannerList" :key="index">
            <van-image :width="item.width" :height="item.height" fit="fill" :src="getImageUrl(item.imageUrl)" /> 
        </van-swipe-item>
    </van-swipe>

</template>
<script setup lang="ts">
    import { defineProps, defineEmits, defineExpose } from "vue"
     const getImageUrl = (name:string) => {
        return new URL(`../../assets/${name}`, import.meta.url).href;
    }
    
    type Banner = {
        width: number,
        height: number,
        imageUrl: string
    }

    defineProps({
        //定义子组件需要接收的值
        bannerList:{
           //数组对象
            type: Array as ()=> Banner[],
            default:[]
        },
    })
    
</script>
<style lang="scss" scoped>
</style>